﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAO;
using Domain;

public partial class imgUpload : System.Web.UI.UserControl
{
    public delegate void SubidaCompletada(Imagen img);
    public event SubidaCompletada SubidaCompletada_Event;

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_upload_Click(object sender, EventArgs e)
    {
        if (fu_logo.HasFile)
        {
            Imagen img = new Imagen(IncrementalDAO.Incrementar(enum_Tipo_Incremental.Imagen), fu_logo.FileBytes);

            if (!ImagenDAO.Guardar(img))
            {
                SubidaCompletada_Event(null);
                return;
            }
            SubidaCompletada_Event(img);
        }
        else
            SubidaCompletada_Event(null);
    }
}
